home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / CMIDI 2.2 / CMIDIInputPort.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-30  |  2.0 KB  |  76 lines  |  [TEXT/KAHL]

  1. /*
  2.  *——— CMIDIInputPort.h ————————————————————————————————————————————————————————
  3.  * Copyright © Paul Ferguson, 1990-94.  All rights reserved.
  4.  *
  5.  * For use with Symantec C++ 6.0 and the THINK Class Library.
  6.  *
  7.  * Description:
  8.  *    This class defines a MIDI Manager Input port object.
  9.  *
  10.  *    Refer to the CMIDI Programmer's Manual for a complete desciption of
  11.  *    this class.
  12.  *————————————————————————————————————————————————————————————————————————————
  13.  */
  14. #pragma once
  15. #include "CMIDIDataPort.h"
  16.  
  17. CLASS CMIDITimePort;
  18.  
  19. class CMIDIInputPort : public CMIDIDataPort
  20. {
  21.  
  22. public:
  23.  
  24.     OSErr     IMIDIInputPort(
  25.                 StringPtr        theName,         // Pascal format, 31 char max
  26.                 OSType            thePortID,
  27.                 Boolean            theVisibleFlag,
  28.                 CMIDITimePort *    theTimePort,
  29.                 long            theOffset,        // Current, nothing, everything
  30.                 short            theBufSize,
  31.                 ProcPtr            theReadHook);
  32. #ifdef __cplusplus
  33.     ProcPtr    GetReadHook(void)
  34.             {
  35.                 return (itsVersion ? MIDIGetReadHook(itsRefNum) : 0);
  36.             };
  37.     void    SetReadHook(ProcPtr theReadHook)
  38.             {
  39.                 if (itsVersion)
  40.                     MIDISetReadHook(itsRefNum, theReadHook);
  41.             };
  42.     void    Flush(void)
  43.             {
  44.                 if (itsVersion >= 0x0200)
  45.                     (*midiFlushProc) (itsRefNum);
  46.                 else
  47.                     if (itsVersion) MIDIFlush(itsRefNum);
  48.             };
  49.     void    Poll(long offsetTime)
  50.             {
  51.                 if (itsVersion >= 0x0200)
  52.                     (*midiPollProc) (itsRefNum, offsetTime);
  53.                 else
  54.                     if (itsVersion) MIDIPoll(itsRefNum, offsetTime);
  55.             };
  56.     void    DiscardPacket(MIDIPacketPtr thePacket)
  57.             {
  58.                 if (itsVersion >= 0x0200)        // Only valid on MM 2.0 or later!
  59.                     (*midiDiscardProc) (itsRefNum, thePacket);
  60.             };
  61. #else
  62.     ProcPtr    GetReadHook(void);
  63.     void    SetReadHook(ProcPtr theReadHook);
  64.     void    Flush(void);
  65.     void    Poll(long offsetTime);
  66.     void    DiscardPacket(MIDIPacketPtr thePacket);
  67. #endif
  68. private:
  69.  
  70.     static pascal void    (*midiDiscardProc) (short theRefNum, MIDIPacketPtr thePacket);
  71.     static pascal void    (*midiPollProc) (short theRefNum, long theOffsetTime);
  72.     static pascal void    (*midiFlushProc) (short theRefNum);
  73. };
  74.  
  75. // end of CMIDIInputPort.h
  76.